{% extends 'iframe/base.html.twig' %}
{% block body %}
<div class="layui-fluid">
    <div class="layui-row">
        <div class="layui-col-md12">
            <div class="layui-card">
                <div class="layui-card-header">
                    列表
                    <div class="layui-btn layui-hide"></div>
                    <a href="javascript:void(0);" class="layui-btn layui-btn-sm dry-right layui-btn-danger doDelete" title="选中的文件会被删除">删除</a>
                    <a href="javascript:void(0);" class="layui-btn layui-btn-sm dry-right layui-btn-normal doMove" title="选中的文件会移动到当前分类">移动</a>
                    <a href="/Admin/File/new" class="layui-btn layui-btn-sm dry-right" id="new">添加</a>
                </div>
                <div class="layui-card-body">
                    <div class="layui-collapse" lay-accordion="">
                        {% for rs in categoryList %}
                            <div class="layui-colla-item">
                                <h2 class="layui-colla-title layui-unselect">{{ rs.dry_name }}({{ rs.total }})</h2>
                                <div class="layui-colla-content {% if loop.first %}layui-show{% endif %}" data="{{ rs.id }}">
                                    <div id="imageShowBox-{{ rs.id }}" count="50" margin="10" width="150" height="150"></div>
                                    <div class="center" id="page{{ rs.id }}"></div>
                                </div>
                            </div>
                        {% endfor %}
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<script>
    layui.use(['jquery', 'file'], function($, fileModule){
        {% for rs in categoryList %}
        fileModule.fileList({{ rs.id }}, {{ rs.total }}, 10, fileModule.loadData, "/Api/File/getListByCategory");
        {% endfor %}
        fileModule.doPlay();
        fileModule.doOverOutClick();
        $(".doMove").click(function(){
            fileModule.doMove("/Api/File/move");
        });
        $(".doDelete").click(function(){
            fileModule.doDelete("/Api/File/delete");
        });
        $("body").on("blur", ".doBlur", function(){
            fileModule.doBlur("/Api/File/rename", $(this).attr("data"), $(this).val());
        });
    });
</script>
{% endblock %}